home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 March / EnigmA AMIGA RUN 05 (1996)(G.R. Edizioni)(IT)[!][issue 1996-03][Skylink CD IV].iso / earcd / comm2 / ftpgadrq.lha / FTPGadReq.rexx next >
OS/2 REXX Batch file  |  1995-12-21  |  3KB  |  127 lines

  1. /*FTPGadReq V2.10
  2.   A simple utility to run GadMget, and then request the selected files
  3.   using DaFTP. 
  4.  
  5.          **** REQUIRES REQREXXTOOLS.LIBRARY, GadMGet, & GZip ****
  6.                        **** Available on Aminet****
  7.  
  8.  FTPGadReq is an Arrex script which filters the output from GadMGet, and
  9. then gets the selected file using AmiFTP or DaFTP. When run,
  10. it  will  display  a  requester  with 5 options
  11.  
  12. RECENT.Z   ---- GET RECENT.Z from your Aminet host, and extract it
  13.  
  14. RECENT     ---- GET RECENT from your host
  15.  
  16. OLD        ---- use the local RECENT file 
  17.  
  18. INDEX      ---- use the local INDEX file
  19.  
  20. REUSE      ---- use the output from the last run of FTPGadReq. (if using
  21.                 the CLIP: device, this may have been overwritten)
  22.  
  23.  
  24. GadMget  will  then run, using the selected file as source.
  25. When files have been selected, and GadMget quit, AmiFTP will then get these
  26. files for you.
  27.  
  28.  When the file has been received, the description for it in Recent or Index
  29. will be added as a file note.
  30.  
  31.  The  variables  below must be set correctly, and gzip must be in your path
  32. for all options to work.
  33.  
  34.  This script is freeware, do with it as you will.
  35.  
  36.  Peter Hanrahan (peterh@fl.net.au)
  37. */ 
  38.  
  39. /*trace results*/
  40.  
  41.  
  42. /*Variables*/
  43. client = 'AMIFTP'           /*AMIFTP or DAFTP */
  44. GadPath = 'AMITCP:GadMget'  /*Path to GadMget*/
  45. Recent='DH3:DL/RECENT'      /*Path to your RECENT file*/
  46. Index='DH3:Internet/Index'  /*Path to your INDEX file*/
  47. GadOut = 'CLIP:'            /*Path to GadMget's output file*/
  48. scre = 'Workbench'          /*Screen for AmiFTP*/
  49. downl='DL:'                 /*Download path*/
  50.  
  51. /*end of variables**/
  52.  
  53. IF ~SHOW(l,"rexxreqtools.library") THEN
  54.     IF ~ADDLIB("rexxreqtools.library", 0, -30, 0) THEN
  55.         EXIT 10
  56.  
  57. /*Select Get source*/
  58. source = rtezrequest("Get Source", "RECENT.Z|RECENT|OLD|INDEX|REUSE","GadMget","rt_pubscrname="||scre)
  59.  
  60. if upper(client)='AMIFTP' then address 'AMIFTP'
  61.  
  62. if upper(client)='DAFTP' then address 'daftp'
  63.  
  64. if source = 1 then do
  65.  
  66.   get 'RECENT.Z'
  67.  
  68.   address command 'gzip -df dl:RECENT.Z'
  69.  
  70. end
  71.  
  72. if source = 2 then do
  73.  
  74.   get 'RECENT'
  75.  
  76. end
  77.  
  78. if source = 4 then recent = index
  79.  
  80. if source> 0 then do
  81.  
  82. call open(gado,gadout,w)
  83. call writech(gado,'0a'x)
  84. call close(gado)
  85. address command gadpath' 'recent 'OUTPUT 'GadOut' KEEPBLANKLINES NOSIMPLEPATHS NOPARSE PUBSCREEN '||scre
  86.  
  87. end
  88.  
  89.  
  90.  
  91. call open(clip,GadOut,r)
  92. stem = 1
  93. call sep
  94. do while ~eof(clip)
  95.   call sep
  96. end
  97. if stem < 2 then exit
  98. call close(clip)
  99. call open(CON,'con:0/400/-1/112/FTP_Request/SCREEN 'scre,'W')
  100. mes = 'Selected 'stem-1' File'
  101. if stem >2 then mes =mes||'s'
  102. call writeln(con,mes)
  103. do count = 1 to stem-1
  104.   call writeln(con,fil.count)
  105. end
  106. call writeln(con,'')
  107.  
  108. do count = 1 to stem-1
  109.   fnam= substr(fil.count,lastpos('/',fil.count)+1)
  110.   call writeln(con,'Requesting 'left(fnam,max(20,length(fnam)+1),' ')siz.count'  'desc.count)
  111.   get fil.count
  112.   if exists(downl||fnam) then address command 'filenote 'downl||fnam' '||'22'x||desc.count||'22'x
  113. end
  114. exit
  115.  
  116. sep:
  117.  lis = readln(clip)
  118.  if eof(clip) then return
  119.  if length(lis) > 2 then lis = left(lis,length(lis)-1)
  120.  w = words(lis)
  121.  if w < 2 then return
  122.  fil.stem = word(lis,2)'/'word(lis,1)
  123.  siz.stem=substr(lis,30,5)
  124.  desc.stem = substr(lis,36)
  125.  stem = stem + 1
  126. return
  127.